import request from '@/utils/http'

export function loginByUsername(username, password) {
  const data = {
    userName: username,
    password: password
  }
  return request(
    '/api/user/login',
    data,
    'post'
  )
}

export function logout(userId) {

    const data = {
        userId: userId,
    }
    return request(
        '/api/user/logout',
        data,
        'post'
    )

}

export function apiGetUserName(userId) {

    const data = {
    }
    return request(
        '/api/user/name/' + userId,
        data,
        'post'
    )

}

export function updateUserInfo(userInfo) {

    const data = userInfo

    return request(
        '/api/user/update/',
        data,
        'post'
    )

}






export function registerUser(signUpForm) {

    const queryData = {
        userName: signUpForm.userName,
        email: signUpForm.email,
        password: signUpForm.password
    }
    return request(
         '/api/user/register', queryData, 'post'
    )
}




